var index = new Vue({
	el : '#container',
	data : {
		currentPageNo : 1,
		pageCount : 1,
		totalRows: 0,
		recordSet : [],
		pageNumbers : [],
		total : 0,
		msg : '',
		keywords : '' 
	},
	components : {
		'vue-nav' : Vnav
	},
	methods : {
		resetPageNumbers : function() {
			this.pageNumbers = [];
			var begin = Math
					.round(Math.max(1, this.currentPageNo - 7 / 2));
			var end = Math.round(Math.min(begin + (7 - 1), this.pageCount));
			for (var i = begin; i <= end; i++) {
				this.pageNumbers.push(i);// 重新写入页码数组
			}
		},
		// 有没有更简单的方法，比如整体赋值
		resetRecordSet : function(dataList) {
			this.recordSet = [];
			for (var i = 0; i < dataList.length; i++) {
				this.recordSet.push(dataList[i]);
			}
		},
		search : function() {
			this.currentPageNo = 1;
			$.ajax({
				url : '/demo/em/es/search?keywords=' + index.keywords,
				type : "POST",
				async : false,
				success : function(result) {
					index.resetRecordSet(result.dataList);

					index.pageCount = result.pageCount;
					index.totalRows=result.sumRows;
					index.resetPageNumbers();
				},
				error : function(result) {
					alert("系统异常");
				}
			});
		},// search
		callback : function(pageNo) {
			this.currentPageNo = pageNo;
			//this.msg = '你点击了' + pageNo + '页';
			$.ajax({
				url : '/demo/em/es/user/getUserList?pageNo=' + this.currentPageNo,
				type : "POST",
				async : false,
				success : function(result) {
					index.resetRecordSet(result.dataList);

					index.pageCount = result.pageCount;
					// this.totalRows=result.sumRows;
					//user.resetPageNumbers();
				},
				error : function(result) {
					alert("系统异常");
				}
			});
		}//callback
	}
// methods area
});
